﻿#define _CRT_SECURE_NO_WARNINGS
#include "12.16_hs.h"
//int main()
//{
//	srand((unsigned int)time(NULL));//随机种子
//	int input;
//	do
//	{
//		option_menu();
//		printf("请选择:->");
//		scanf("%d", &input);
//		switch (input)
//		{
//		case 1:
//			system("cls");
//			printf("游戏开始!!!\n");
//			game();
//			break;
//		case 0:
//			system("cls");
//			printf("游戏退出!!!\n");
//			break;
//		default:
//			system("cls");
//			printf("无效选择,请重新选择!!!\n");
//			break;
//		}
//	} while (input);
//	return 0;
//}

//int main()
//{
//	char s1[] = "abcdef";
//	char s2[] = { 'a','b','c','d','e','f' };
//	char s3[3][5] = { 0 };
//	char* pc = "abcdef";//a b c d e f \0
//	printf("%zd\n", sizeof(int));
//	printf("%zd\n", sizeof(7));
//	printf("%zd\n", sizeof('c'));
//	printf("%zd %zd %zd\n", strlen(pc), strlen(pc + 2), strlen(pc + 6));
//	printf("%zd\n%zd\n", strlen(s1), strlen(s2));
//	printf("%zd %zd %zd", sizeof(s1), sizeof(s2), sizeof(s3[4]));
//	return 0;
//}

//int main()
//{
//	int a[] = { 1,2,3,4 };
//	printf("%zd\n", sizeof(a));//16
//	printf("%zd\n", sizeof(a + 0));//4/8
//	printf("%zd\n", sizeof(*a));//4
//	printf("%zd\n", sizeof(a + 1));//4/8
//	printf("%zd\n", sizeof(a[1]));//4
//	printf("%zd\n", sizeof(&a));//4/8
//	printf("%zd\n", sizeof(*&a));//16
//	printf("%zd\n", sizeof(&a + 1));//4/8
//	printf("%zd\n", sizeof(&a[0]));//4/8
//	printf("%zd\n", sizeof(&a[0] + 1));//4/8
//	return 0;
//}

//int main()
//{
//	char arr[] = { 'a','b', 'c', 'd', 'e', 'f' };//a b c d e f
//	printf("%zd\n", sizeof(arr));//6
//	printf("%zd\n", sizeof(arr + 0));//4/8
//	printf("%zd\n", sizeof(*arr));//1
//	printf("%zd\n", sizeof(arr[1]));//1
//	printf("%zd\n", sizeof(&arr));//4/8
//	printf("%zd\n", sizeof(&arr + 1));//4/8
//	printf("%zd\n", sizeof(&arr[0] + 1));//4/8
//	return 0;
//}

//int main()
//{
//	char arr[] = { 'a','b', 'c', 'd', 'e', 'f' };//6个元素
//	printf("%zd\n", strlen(arr));//随机值
//	printf("%zd\n", strlen(arr + 0));//随机值
//	//printf("%zd\n", strlen(*arr));//非法访问
//	//printf("%zd\n", strlen(arr[1]));//非法访问
//	printf("%zd\n", strlen(&arr));//随机值
//	printf("%zd\n", strlen(&arr + 1));//随机值
//	printf("%zd\n", strlen(&arr[0] + 1));//随机值
//	return 0;
//}

//int main()
//{
//	char arr[] = "abcdef";//7个元素
//	printf("%zd\n", sizeof(arr));//7
//	printf("%zd\n", sizeof(arr + 0));//4/8
//	printf("%zd\n", sizeof(*arr));//1
//	printf("%zd\n", sizeof(arr[1]));//1
//	printf("%zd\n", sizeof(&arr));//4/8
//	printf("%zd\n", sizeof(&arr + 1));//4/8
//	printf("%zd\n", sizeof(&arr[0] + 1));//4/8
//	return 0;
//}

//int main()
//{
//	char arr[] = "abcdef";//7个元素
//	printf("%zd\n", strlen(arr));//6
//	printf("%zd\n", strlen(arr + 0));//6
//	//printf("%zd\n", strlen(*arr));//非法访问
//	//printf("%zd\n", strlen(arr[1]));//非法访问
//	printf("%zd\n", strlen(&arr));//6
//	printf("%zd\n", strlen(&arr + 1));//随机值
//	printf("%zd\n", strlen(&arr[0] + 1));//5
//	return 0;
//}

//int main()
//{
//	char* p = "abcdef";//7个元素
//	printf("%zd\n", sizeof(p));//4/8
//	printf("%zd\n", sizeof(p + 1));//4/8 
//	printf("%zd\n", sizeof(*p));//1
//	printf("%zd\n", sizeof(p[0]));//1
//	printf("%zd\n", sizeof(&p));//4/8
//	printf("%zd\n", sizeof(&p + 1));//4/8
//	printf("%zd\n", sizeof(&p[0] + 1));//4/8
//	return 0;
//}

//int main()
//{
//	char* p = "abcdef";//7个元素
//	printf("%zd\n", strlen(p));//6
//	printf("%zd\n", strlen(p + 1));//5
//	//printf("%zd\n", strlen(*p));//非法访问
//	//printf("%zd\n", strlen(p[0]));//非法访问
//	printf("%zd\n", strlen(&p));//6
//	printf("%zd\n", strlen(&p + 1));//随机值
//	printf("%zd\n", strlen(&p[0] + 1));//5
//	return 0;
//}

//int main()
//{
//	int a[3][4] = { 0 };//12个元素
//	printf("%zd\n", sizeof(a));//48
//	printf("%zd\n", sizeof(a[0][0]));//4
//	printf("%zd\n", sizeof(a[0]));//16
//	printf("%zd\n", sizeof(a[0] + 1));//4/8
//	printf("%zd\n", sizeof(*(a[0] + 1)));//4
//	printf("%zd\n", sizeof(a + 1));//4/8
//	printf("%zd\n", sizeof(*(a + 1)));//16
//	printf("%zd\n", sizeof(&a[0] + 1));//4/8
//	printf("%zd\n", sizeof(*(&a[0] + 1)));//16
//	printf("%zd\n", sizeof(*a));//16
//	printf("%zd\n", sizeof(a[3]));//16
//	return 0;
//}

//int main()
//{
//	int a[5] = { 1, 2, 3, 4, 5 };
//	int* ptr = (int*)(&a + 1);
//	printf("%d,%d", *(a + 1), *(ptr - 1));//2,5
//	return 0;
//}

////在X86环境下
////假设结构体的⼤⼩是20个字节
////程序输出的结果是啥？
//struct test
//{
//	int Num;
//	char* pcName;
//	short sDate;
//	char cha[2];
//	short sBa[4];
//}*p = (struct Test*)0x100000;
//
//int main()
//{
//	//特备要注意十六进制的加减
//	printf("%p\n", p + 0x1);//0x100014
//	printf("%p\n", (unsigned long)p + 16*0x1);//0x100001
//	printf("%p\n", (unsigned int*)p + 0x1);//0x100004
//	return 0;
//}

//int main()
//{
//	int a[3][2] = { (0, 1), (2, 3), (4, 5) };
//	//1 3
//	//5 0
//	//0 0
//	int* p;
//	p = a[0];
//	printf("%d", p[0]);//1
//	return 0;
//}

//int main()
//{
//	int a[5][5];
//	int(*p)[4];
//	p = a;
//	printf("%p,%d\n", &p[4][2] - &a[4][2], &p[4][2] - &a[4][2]);//FFFFFFFC -4	
//	return 0;
//}